/*
 * Copyright (C) 拾光分享网 
 * All rights reserved, Designed By www.hiai.top.
 * Email：goodsking@163.com.
 */
package top.hiai.common.model;

import top.hiai.common.model.base.MessageBase;
import top.hiai.common.util.JsoupFilter;

/**
* @Author www.hiai.top
* @Email  goodsking@163.com
* @Message 更多资源尽在www.hiai.top
* @Introduction 类的介绍
*/
@SuppressWarnings("serial")
public class Message extends MessageBase<Message>  {
	
    public static final int TYPE_NORMAL = 0;    // 普通消息
    public static final int TYPE_SYSTEM = 1;    // 系统消息
    
    /**
     * 过滤 title content 字段的 html 标记，防止 XSS 攻击
     * 将回车换行转换成 <br> 标记便于 html 中显示换行
     */
    protected void filter(int filterBy) {
        String content = getContent().trim().replaceAll("\r\n", "<br>").replaceAll("\n", "<br>").replaceAll("\r", "<br>");
        content = JsoupFilter.filterArticleContent(content);
        setContent(content);
    }

}